let Ajaxtimes = 0;
export const request = (params) => {

    Ajaxtimes++
    return new Promise((resolve, reject) => {
        const baseurl = "https://api-hmugo-web.itheima.net/api/public/v1"

        wx.showLoading({
            title: '加载中',
        })
        wx.request({
            url: baseurl + params.url,
            method: params.method,
            data: params.data,
            success: (result) => {
                resolve(result)

            },
            fail: (result) => {
                reject(result)
            },
            complete: () => {
                Ajaxtimes--
                if (Ajaxtimes == 0) {
                    wx.hideLoading()
                }

            }
        }

        )
    })
}